<?php
defined('IN_MAIN') or exit('Invalid Access!');

function format_search_field($field, $q, $bool="or"){
 $rq=explode(",", $q);
 if(count($rq)){
  for($i=0;$i<count($rq);$i++){
   if(strlen($rq[$i])){
    $formatted_q.=($formatted_q? " $bool " : "")."$field='$rq[$i]'";
   }
  }
 }
 return $formatted_q;
}

function format_search_field_like($field, $q, $bool="or"){
 $rq=explode(",", $q);
 if(count($rq)){
  for($i=0;$i<count($rq);$i++){
   if(strlen($rq[$i])){
    $formatted_q.=($formatted_q? " $bool " : "")."$field like '%$rq[$i]%'";
   }
  }
 }
 return $formatted_q;
}
?>